<?php
if (ini_get('session.auto_start') == 0)session_start();
require_once '../sub/init.php';
require_once ZEAI.'sub/conn.php';
//if (ifint($cook_tg_uid)){header("Location: tg_my.php");exit;}
if(@!in_array('tg',$navarr))exit("<div style='font-size:30px;text-align:center;margin:50px'>推广功能暂未开启</div>");
if (!is_mobile())exit('请用手机打开');
require_once ZEAI.'cache/config_reg.php';
require_once ZEAI.'cache/config_shop.php';
require_once ZEAI.'cache/config_sms.php';
require_once ZEAI.'sub/www_zeai_cn_sms.php';
$TG_set = json_decode(stripslashes($_REG['TG_set']),true);
$k = (!ifint($k))?1:$k;

$cook_tg_uid=intval($cook_tg_uid);
require_once ZEAI.'sub/TGfun.php';
//微信自动进入
if(is_weixin() && empty($submitok)){
	if(isset($cook_tg_openid) && !empty($cook_tg_openid) ){
		$server_tg_openid = $cook_tg_openid;
	}else{
		$server_tg_openid = wx_get_openid(0);
		setcookie("cook_tg_openid",$server_tg_openid,time()+7200000,"/",$_ZEAI['CookDomain']);
	}
	$row = $db->ROW(__TBL_TG_USER__,"id,flag,pwd","openid<>'' AND openid='".$server_tg_openid."'","num");
	if ($row){
		$tg_uid = $row[0];$flag = $row[1];$tg_pwd = $row[2];
		if ($flag==-1)alert('您的帐号已被锁定','back');
		setcookie("cook_tg_uid",$tg_uid,time()+31536000,"/",$_ZEAI['CookDomain']);
		setcookie("cook_tg_pwd",$tg_pwd,time()+31536000,"/",$_ZEAI['CookDomain']);
		if($loginkind=='shop'){
			header("Location: shop_my.php");
		}else{
			header("Location: tg_my.php");
		}
	}
}
//微信自动进入END
/******************************************************/
//kind，1:会员升级,2:loveb充值,3:余额充值,3:余额充值，4活动报名费，5推广升级，6推广激活，7认证
if($submitok == 'ajax_pay_jh'){
	if($TG_set['active_price']==0 && ifint($cook_tg_uid)){
		$flag = ($TG_set['regflag'] == 1)?0:1;
		$db->query("UPDATE ".__TBL_TG_USER__." SET flag=$flag WHERE id=".$cook_tg_uid);
		json_exit(array('flag'=>'success','msg'=>'激活成功'));
	}
	if ($kind != 6)json_exit(array('flag'=>0,'msg'=>'kind!=6，请联系管理员'));//kind=6推广激活
	require_once ZEAI.'cache/config_vip.php';
	require_once ZEAI.'cache/config_pay.php';
	$paymoney = abs(round($money,2));

	$orderid_title = '推广激活';
	$return_url = HOST.'/m/tg_my.php';
	$jump_url   = HOST.'/m/tg_my.php';
	
	if(str_len($orderid) <10 )json_exit(array('flag'=>0,'msg'=>'订单号异常~'));
	if ($paykind=='wxpay' || $paykind=='alipay'){
		$rowpay = $db->ROW(__TBL_PAY__,"flag","orderid='$orderid'",'num');
		if ($rowpay){
			if ($rowpay[0] == 1)json_exit(array('flag'=>0,'msg'=>'该订单已支付完成，您无需重复支付了'));	
		}else{
			$money_list_id = intval($grade);
			$paytime       = 0;
			$db->query("INSERT INTO ".__TBL_PAY__."(orderid,kind,tg_uid,title,money,paymoney,addtime,money_list_id,paytime) VALUES ('$orderid',$kind,$cook_tg_uid,'$orderid_title',$money,$paymoney,".ADDTIME.",$money_list_id,$paytime)");
			$payid = $db->insert_id();
		}
		/*====================测试支付会员ID=====================*/
		//if ($cook_uid == 8){$paymoney = 0.01;}
	}
	if ($paykind=='wxpay' ){
		$total_fee = $paymoney*100;//分
		include_once(ZEAI."api/weixin/pay/WxPayPubHelper/WxPayPubHelper.php");
		//微信内部
		if (is_weixin()){
			if(str_len($cook_tg_openid) < 10)json_exit(array('flag'=>0,'msg'=>'获取OPENID异常'));
			$jsApi = new JsApi_pub();	
			$unifiedOrder = new UnifiedOrder_pub();	
			$unifiedOrder->setParameter("openid",$cook_tg_openid);
			$unifiedOrder->setParameter("out_trade_no",$orderid);//商户订单号 
			$unifiedOrder->setParameter("total_fee",$total_fee);//总金额
			$unifiedOrder->setParameter("notify_url",WxPayConf_pub::NOTIFY_URL);//通知地址
			$unifiedOrder->setParameter("trade_type","JSAPI");//交易类型	
			$unifiedOrder->setParameter("body",$orderid_title);//商品描述
			$unifiedOrder->setParameter("attach",$payid);//附加数据	
			$prepay_id = $unifiedOrder->getPrepayId();
			$jsApi->setPrepayId($prepay_id);
			$jsApiParameters = $jsApi->getParameters();
			$jsApiParameters = json_decode($jsApiParameters,true);
			$db->query("UPDATE ".__TBL_PAY__." SET bz='手机微信支付(内部JSAPI)' WHERE id=".$payid);
			json_exit(array('flag'=>1,'jump_url'=>$jump_url,'redirect_url'=>$return_url,'trade_type'=>'JSAPI','msg'=>'jsapi调起支付','jsApiParameters'=>$jsApiParameters));
		//H5外部
		}else{
			if(!is_mobile()){exit("请用手机操作");}
			require_once ZEAI.'api/weixin/pay/h5pay_func.php';
			$H5PAY = new www_zeai_cn_h5pay_class();
			$pay_data=array(
				'trade_type'=>"MWEB",
				'appid'=>APPID_,
				'mch_id'=>MCHID_,
				'nonce_str'=>$H5PAY->get_rand_str(32),
				'out_trade_no'=>$orderid,
				'body'=>$orderid_title,
				'total_fee'=>$total_fee,
				'notify_url'=>NOTIFY_URL_,
				'spbill_create_ip'=>$H5PAY->siteip()
			);
			$pay_data['sign'] = $H5PAY->MakeSign($pay_data);
			$pay_vars     = $H5PAY->ToXml($pay_data);
			$re_data      = $H5PAY->curl_post_ssl($pay_vars);
			$wxpay_arr    = $H5PAY->FromXml($re_data);
			if($wxpay_arr['return_code']=="SUCCESS" && $wxpay_arr['result_code']=="SUCCESS"){
				$pay_url  = $wxpay_arr['mweb_url'];
				$pay_url .= '&redirect_url='.urlencode($return_url);//成功跳转url
				$db->query("UPDATE ".__TBL_PAY__." SET bz='手机微信支付(外部WAP/H5)' WHERE id=".$payid);
				json_exit(array('flag'=>1,'trade_type'=>'H5','msg'=>'H5调起支付','redirect_url'=>$pay_url));
			}else{
				json_exit(array('flag'=>0,'trade_type'=>'H5','msg'=>'商户平台H5支付没开通或参数不正确','redirect_url'=>$redirect_url));
			}
		}
	}
	exit;
}
/******************************************************/
$headertitle = $TG_set['tgytitle'].'注册-';$nav = '';require_once ZEAI.'m/header.php';?>
<link href="<?php echo RES;?>m/css/tg_loginreg.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<style>
.tg_reg_kefu{width:100%;max-width:750px;margin:auto;left:0;right:0;position:fixed;bottom:4rem}
.tg_reg_kefu img{width:25%;margin:1rem auto;display:block;padding:.5rem;border:#eee 1px solid}
.tg_reg_kefu font{color:#999}
.tg_reg_kefu a{margin-top:1rem;display:block;color:#666}
.tg_reg_kefu .ico{margin-right:.4rem}
</style>
<?php 
$mini_title_str='';	
if($submitok == 'success' || $submitok == 'flag2')$mini_title_str='';
$mini_title=$mini_title_str;
$mini_class = 'top_mini4';
$mini_L = '<em onClick="zeai.back()"><i class="ico" >&#xe602;</i><span></span></em>';
require_once ZEAI.'m/top_mini.php';
$kf_tel=dataIO($_ZEAI['kf_tel'],'out');$kf_mob=dataIO($_ZEAI['kf_mob'],'out');$kf_qq=dataIO($_ZEAI['kf_qq'],'out');$kf_wxpic=dataIO($_ZEAI['kf_wxpic'],'out');
if ($submitok == 'success'){
	$row = $db->ROW(__TBL_TG_USER__,"nickname,mob,flag,grade","id=".$cook_tg_uid,"num");
	if ($row){
		$uname= $row[0];
		$mob  = $row[1];
		$flag = $row[2];
		$grade= $row[3];
	}else{
		header("Location: tg_login.php");exit;
	}
	switch ($flag) {
		case 2:header("Location: tg_reg.php?submitok=flag2");break;
		case 1:header("Location: tg_my.php");break;
		case -1:header("Location: tg_reg.php?submitok=flag_1");break;
		case 0:header("Location: tg_reg.php?submitok=flag0");break;
	}
	$uname = (empty($uname))?$mob:$uname;?>
    <div class="tgregsuccess">
        <br><br>
        <i class="ico">&#xe67f;</i>
        <h2><font class="S16"><?php echo $uname;?>，ID：<?php echo $cook_tg_uid;?></font><br><br><font class="B S18">恭喜您注册成功</font></h2>
        <br><br>
		<?php switch ($k){case 1:?>
            <a href="tg_my.php" class="btn size5 HONG3 W80_ yuan">进入<?php echo $TG_set['navtitle'];?></a>
		<?php break;case 2://跳到入驻页面?>
        	<a href="<?php echo HOST;?>/m/shop_my_apply.php" class="btn size5 HONG3 W80_ yuan">下一步</a>
        <?php break;case 3:?>
        	<a href="<?php echo HOST;?>/m/shop_index.php" class="btn size5 HONG3 W80_ yuan">进入<?php echo $_SHOP['title'];?></a>
        <?php break;}?>
    </div>
<?php }elseif($submitok == 'flag0'){
	$row = $db->ROW(__TBL_TG_USER__,"nickname,mob,flag","id=".$cook_tg_uid,"num");
	if ($row){
		$uname= $row[0];
		$mob  = $row[1];
		$flag = $row[2];
	}else{
		header("Location: tg_login.php");exit;
	}
	switch ($flag) {
		case 2:header("Location: tg_reg.php?submitok=flag2");break;
		case 1:header("Location: tg_my.php");break;
		case -1:header("Location: tg_reg.php?submitok=flag_1");break;
	}
	$uname = (empty($uname))?$mob:$uname;?>
    <div style="text-align:center;margin-top:5rem">
        <i class="ico" style="font-size:6rem;color:#F7564D;margin-bottom:2rem">&#xe634;</i>
        <h4>您的帐号“<?php echo $uname;?>，ID：<?php echo $cook_tg_uid;?>”审核中<br><br>请耐心等待...</h4><br>
        <br><br>
        <h3><?php echo $title;?></h3>
        <a href="tg_index.php" class="btn size4 HONG3 yuan" style="width:60%">进入<?php echo $TG_set['navtitle'];?>首页</a>
        <div class="tg_reg_kefu">
        <?php if (!empty($kf_wxpic) ){?><img src="<?php echo UP.$kf_wxpic;?>"><font>长按二维码加客服微信</font><br><?php }?>
        <?php if (!empty($kf_tel)){?>
            <a href="tel:<?php echo $kf_tel;?>" class="C999"><i class="ico">&#xe7c1;</i><?php echo $kf_tel;?></a><br>
        <?php }else{?>
            <?php if (!empty($kf_mob)){?><i class="ico">&#xe7c1;</i><a href="tel:<?php echo $kf_mob;?>" class="C999"><?php echo $kf_mob;?></a><?php }?>
        <?php }?>
        </div>
    </div>
<?php }elseif($submitok == 'flag_1'){
	$row = $db->ROW(__TBL_TG_USER__,"nickname,mob,kind,flag","id=".$cook_tg_uid,"num");
	if ($row){
		$uname= $row[0];
		$mob  = $row[1];
		$kind = $row[2];
		$flag = $row[3];
	}
	switch ($flag) {
		case 0:header("Location: tg_reg.php?submitok=flag0");break;
		case 1:header("Location: tg_my.php");break;
		case 2:header("Location: tg_reg.php?submitok=flag2");break;
	}
	$uname = (empty($uname))?$mob:$uname;?>
    <div class="submain" style="text-align:center;margin-top:5rem">
    <i class="ico" style="font-size:60px;color:#247AF2">&#xe620;</i><br><br>
    <h4 style="color:#247AF2">您的帐号“<?php echo $uname;?>，ID：<?php echo $cook_tg_uid;?>”已被锁定</h4><br>
    <br><br><br>
    <h3><?php echo $title;?></h3>
    <a href="tg_index.php" class="btn size4 HONG3 yuan" style="width:60%">进入<?php echo $TG_set['navtitle'];?></a>
	</div>
<?php }elseif($submitok == 'flag2'){
	$row = $db->ROW(__TBL_TG_USER__,"nickname,mob,flag,grade,uname","id=".$cook_tg_uid,"num");
	if ($row){
		$nickname= trimhtml(dataIO($row[0],'out'));
		$mob  = $row[1];
		$flag = $row[2];
		$grade= $row[3];
		$uname= trimhtml(dataIO($row[4],'out'));
	}else{
		header("Location: tg_login.php");exit;
	}
	switch ($flag) {
		case 0:header("Location: tg_reg.php?submitok=flag0");break;
		case 1:header("Location: tg_my.php");break;
		case -1:header("Location: tg_reg.php?submitok=flag_1");break;
	}
	$uname = (empty($nickname))?$uname:$nickname;
	$uname = (empty($uname))?$mob:$uname;?>
    <link href="<?php echo RES;?>m/css/TG2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
    <style>
	.nextbtn{width:100%;max-width:75rem;height:10.3rem;padding-top:2rem;padding-bottom:3.3rem;position:fixed;bottom:0;left:0;right:0;margin:auto;background-color:#fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;z-index:889}
	.nextbtn a.btn{box-shadow:0 .3rem .8rem #ffd6d4;width:70%;max-width:750px;margin:0 auto;border-radius:3rem;display:inline-block;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}
    </style>
	<?php 
    $row_role=$db->ROW(__TBL_TG_ROLE__,"*","shopgrade=0 AND grade=".$grade,"name");
    $data_gradetitle=$row_role['title'];
    $reward_kind=$row_role['reward_kind'];
    if($reward_kind=='loveb'){//loveb
    //	$reg_sex1_num1  = intval($row_role['reg_loveb_sex1_num1']);
    //	$reg_sex1_num2  = intval($row_role['reg_loveb_sex1_num2']);
    //	$reg_sex2_num1  = intval($row_role['reg_loveb_sex2_num1']);
    //	$reg_sex2_num2  = intval($row_role['reg_loveb_sex2_num2']);
        $priceT = $_ZEAI['loveB'];
    }elseif($reward_kind=='money'){//元
        $reg_sex1_num1  = floatval($row_role['reg_money_sex1_num1']);
        $reg_sex1_num2  = floatval($row_role['reg_money_sex1_num2']);
        $reg_sex2_num1  = floatval($row_role['reg_money_sex2_num1']);
        $reg_sex2_num2  = floatval($row_role['reg_money_sex2_num2']);
    
        $cz_sex1_num1  = intval($row_role['cz_sex1_num1']);
        $cz_sex1_num2  = intval($row_role['cz_sex1_num2']);
        $cz_sex2_num1  = intval($row_role['cz_sex2_num1']);
        $cz_sex2_num2  = intval($row_role['cz_sex2_num2']);
        
        $vip_sex1_num1 = intval($row_role['vip_sex1_num1']);
        $vip_sex1_num2 = intval($row_role['vip_sex1_num2']);
        $vip_sex2_num1 = intval($row_role['vip_sex2_num1']);
        $vip_sex2_num2 = intval($row_role['vip_sex2_num2']);
    
        $rz_sex1_num1 = intval($row_role['rz_sex1_num1']);
        $rz_sex1_num2 = intval($row_role['rz_sex1_num2']);
        $rz_sex2_num1 = intval($row_role['rz_sex2_num1']);
        $rz_sex2_num2 = intval($row_role['rz_sex2_num2']);
        
        $union_reg_num1  = floatval($row_role['union_reg_num1']);
        $union_reg_num2  = floatval($row_role['union_reg_num2']);
        $union_num1 = intval($row_role['union_num1']);
        $union_num2 = intval($row_role['union_num2']);
    
        $priceT = '元';
    }
    ?>
    <div class="submain TG_HELP" style="text-align:center;padding-top:0">
        <i class="ico" style="font-size:8rem;color:#FF6A00">&#xe69d;</i><br><br>
        <h3 class="B" style="color:#FF6A00">激活帐号</h3><br>
        <h4>你的帐号“<?php echo $uname;?>，ID:<?php echo $cook_tg_uid;?>”还未激活</h4><br>
        <?php if ($TG_set['active_price']>0){?><h4>请支付 <font class="Cf00 S18" style="font-family:Arial">¥<?php echo $TG_set['active_price'];?></font> 元激活，成为<?php echo $data_gradetitle;?></h4><br><?php }?>
        <h3><?php echo $title;?></h3><br /><br />
        <div class="nextbtn">
            <a class="btn size4 HONG3 yuan" onClick="tg_jh(<?php echo $TG_set['active_price'];?>);"><?php echo ($TG_set['active_price']>0)?'立即支付（¥'.$TG_set['active_price'].'）':'开始激活';?></a>
        </div>        
        <!--调帮助-->
        <h2><?php echo $data_gradetitle;?>收益明细</h2>
        <ul class="sy">
            <?php if ($reg_sex1_num1>0 || $reg_sex2_num1>0 || $reg_sex1_num2>0 || $reg_sex2_num2>0){?>
            <li>
                <h5>推荐单身用户注册</h5>
                <p>直接奖励：男<b> <?php echo ($reg_sex1_num1>0)?$reg_sex1_num1.$priceT.'/人':'无';?></b>　女<b> <?php echo ($reg_sex2_num1>0)?$reg_sex2_num1.$priceT.'/人':'无';?></b> <br>(您直接分享注册的用户，一级小伙伴)</p>
                <p>团队奖励：男<b> <?php echo ($reg_sex1_num2>0)?$reg_sex1_num2.$priceT.'/人':'无';?></b>　女<b> <?php echo ($reg_sex2_num2>0)?$reg_sex2_num2.$priceT.'/人':'无';?></b> <br>(您的一级小伙伴成员又分享注册了用户)</p>
                <?php echo ($TG_set['reward_flag'] == 1)?'':'<em>注：为防刷单，网站开启了验证功能，新注册用户需客服人员核验真实有效后奖励，已注册的用户【充值/升VIP/认证】直接奖励无需审核</em>';?>
            </li>
            <?php }
            if ($cz_sex1_num1>0 || $cz_sex2_num1>0 || $cz_sex1_num2>0 || $cz_sex2_num2>0){?>
            <li>
                <h5>单身用户在线充值</h5>
                <p>直接奖励：男<b><?php echo ($cz_sex1_num1>0)?$cz_sex1_num1.'%':'无';?></b>　女<b><?php echo ($cz_sex2_num1>0)?$cz_sex2_num1.'%':'无';?></b></p>
                <p>团队奖励：男<b><?php echo ($cz_sex1_num2>0)?$cz_sex1_num2.'%':'无';?></b>　女<b><?php echo ($cz_sex2_num2>0)?$cz_sex2_num2.'%':'无';?></b></p>
            </li>
            <?php }
            if ($vip_sex1_num1>0 || $vip_sex2_num1>0 || $vip_sex1_num2>0 || $vip_sex2_num2>0){?>
            <li>
                <h5>单身用户开通VIP</h5>
                <p>直接奖励：男<b><?php echo ($vip_sex1_num1>0)?$vip_sex1_num1.'%':'无';?></b>　女<b><?php echo ($vip_sex2_num1>0)?$vip_sex2_num1.'%':'无';?></b></p>
                <p>团队奖励：男<b><?php echo ($vip_sex1_num2>0)?$vip_sex1_num2.'%':'无';?></b>　女<b><?php echo ($vip_sex2_num2>0)?$vip_sex2_num2.'%':'无';?></b></p>
            </li>
            <?php }
            if ($rz_sex1_num1>0 || $rz_sex1_num1>0 || $rz_sex2_num2>0 || $rz_sex2_num2>0){?>
            <li>
                <h5>单身用户认证奖励（实名+真人）</h5>
                <p>直接奖励：男<b><?php echo ($rz_sex1_num1>0)?$rz_sex1_num1.'%':'无';?></b>　女<b><?php echo ($rz_sex1_num1>0)?$rz_sex2_num1.'%':'无';?></b></p>
                <p>团队奖励：男<b><?php echo ($rz_sex2_num2>0)?$rz_sex1_num2.'%':'无';?></b>　女<b><?php echo ($rz_sex2_num2>0)?$rz_sex2_num2.'%':'无';?></b></p>
            </li>
            <?php }
            if ($union_reg_num1>0 || $union_reg_num2>0){?>
            <li>
                <h5>推荐合伙人注册</h5>
                <?php if ($union_reg_num1>0){?><p>直接奖励：<b><?php echo $union_reg_num1;?><?php echo $priceT;?></b>/个</b></p><?php }?>
                <?php if ($union_reg_num2>0){?><p>团队奖励：<b><?php echo $union_reg_num2;?><?php echo $priceT;?></b>/个</b></p><?php }?>
            </li>
            <?php }
            if ($union_num1>0 || $union_num2>0){?>
            <li>
                <h5>合伙人激活/升级</h5>
                <p>您分享注册的推广员激活帐号或升级至更高级别的推广员</p>
                <?php if ($union_num1>0){?><p>直接奖励：<b><?php echo $union_num1;?>%</b></p><?php }?>
                <?php if ($union_num2>0){?><p>团队奖励：<b><?php echo $union_num2;?>%</b></p><?php }?>
            </li>
            <?php }?>
        </ul><br>
        <!---->
	</div>
	<script>
    <?php
    $orderid = 'TG-'.$cook_tg_uid.'-'.date("YmdHis");
    ?>
    var kind = 6,orderid = '<?php echo $orderid;?>';
    function tg_jh(money){
        var jsonurl={'url':MHOST+'/tg_reg'+zeai.extname,'js':1,'data':{'submitok':'ajax_pay_jh','money':money,'paykind':'wxpay','kind':kind  ,'orderid':orderid}};
    <?php //if (is_weixin()){?>
        zeai.msg('正在微信支付..');
        zeai.ajax(jsonurl,function(e){rs=zeai.jsoneval(e);
            zeai.msg(0);
            if (rs.flag==1){
                if (rs.trade_type=='H5'){
                    zeai.openurl(rs.redirect_url);
                }else{
                    function jsApiCall(){
                        WeixinJSBridge.invoke('getBrandWCPayRequest',rs.jsApiParameters,function(res){
                            //WeixinJSBridge.log(res.err_msg);
                            if(res.err_msg == "get_brand_wcpay_request:ok"){
                                zeai.msg("支付成功");
                                setTimeout(function(){zeai.openurl(rs.redirect_url);},1000);
                            }else{
                               zeai.msg("支付失败,请返回上一步重新支付~~");
                               //alert(JSON.stringify(res));
                            }				
                        });
                    }
                    if (typeof WeixinJSBridge == "undefined"){
                        if( document.addEventListener ){
                            document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                        }else if (document.attachEvent){
                            document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
                            document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                        }
                    }else{
                        jsApiCall();
                    }
                }
			}else if(rs.flag=='success'){
				 zeai.msg(rs.msg);
				setTimeout(function(){zeai.openurl('tg_my'+zeai.extname);},1000);
            }else{
                zeai.msg(rs.msg);	
            }
        });
    <?php //}else{ ?>
        //zeai.msg('请在微信中使用');
    <?php //}?>
    }
    </script>    
<?php }else{
	if (ifint($cook_tg_uid)){
		$row = $db->ROW(__TBL_TG_USER__,"uname,nickname,mob","id=".$cook_tg_uid." AND pwd='".$cook_tg_pwd."'","num");
		if ($row){
			$uname= trimhtml(dataIO($row[0],'out'));
			$nickname= trimhtml(dataIO($row[1],'out'));
			$mob  = $row[2];
			$uname = (empty($nickname))?$uname:$nickname;
			$uname = (empty($uname))?$mob:$uname;?>
            
            <style>
			.tgreg .size4{line-height:5rem;height:5rem;font-size:1.6rem;box-shadow:0 .3rem .8rem rgba(247,86,77,.4);background-color:#F7564D;border:0;color:#fff}
           
            </style>
            <div class="tgreg" style="text-align:center;margin-top:6rem">
            <form>
            <i class="ico" style="font-size:6rem;color:#45C01A;margin-bottom:2rem">&#xe67f;</i>
            <h4>您的帐号 “<?php echo $uname;?>，ID：<?php echo $cook_tg_uid;?>” 已登录</h4><br>
            <h4>请选择下方按钮进入</h4><br><br>
            <a href="tg_my.php" class="btn size4" style="width:70%;margin-bottom:0"><?php echo $TG_set['navtitle'];?>中心</a><br><br>
            <a href="shop_my.php" class="btn size4" style="width:70%;margin-top:0"><?php echo $_SHOP['title'];?>中心</a>
            </form>
            </div>
            <?php 
            exit('</body></html>');
		}
	}
	header("Location: tg_login.php");
}?>
</body></html>